<template>
	<view>
		<image class="cardTopBackground" src="../../static/image/personal-background.jpg" />
		<view class="per-card">
			<image class="img100" src="../../static/image/card1.png" mode="aspectFill" />
			<view class="cardText text-bold mart50" v-if="IconLogo != ''">
				<image class="cu-avatar round lg" src="../../static/logo.png" mode="" />
				<view class="margin-top-sm">Kill</view>
			</view>
			<view class="cardText text-bold mart50"  v-else>
				<image class="cu-avatar round lg" :src="IconLogo" mode="aspectFit" />
				<view class="margin-top-sm">{{code}}</view>
				<button type="default" open-type="getUserInfo" @getuserinfo="toUserInfo">点击获取</button>
			</view>
		</view>
		<view class="per-list">
			<navigator url="../VipDetails/VipDetails">
				<view class="perLi-te">
					会员权益
				</view>
			</navigator>
			<navigator url="../PointsMall/PointsMall">
				<view class="perLi-te">
					积分兑换
				</view>
			</navigator>
			<navigator url="../Mycoupon/Mycoupon">
				<view class="perLi-te">
					我的优惠券
				</view>
			</navigator>
		</view>
		
		cb70014665f518783684f98d73875e8311a2002c
	</view>
</template>

<script>
	export default {
		data() {
			return {
				login: 1,
				navVip: 0,
				code: null,
				IconLogo: ""
			};
		},
		methods: {
			toUserInfo(e) {
				console.log("获取用户信息:",e)
				var userinfo = e.detail.userInfo
				uni.login({
					provider: 'weixin',
					success: function(loginRes) {
						console.log("code:",loginRes.code)
						if (loginRes.code) {
							// 获取用户信息
							uni.request({
								url: "https://apis.map.qq.com/login",
								data: {
									code: loginRes.code
								},
								header: {
									'content-type': 'application/json', //请求头
								},
								success(result) {
									console.log("result", result)
								}
							})
							uni.getUserInfo({
								provider: 'weixin',
								success: function(infoRes) {
									console.log('用户昵称为：', infoRes.userInfo)
								}
							})
						} else {}

					}
				})

			}

		}
	}
</script>

<style lang="less">
	@import url("@/static/css/components.less");

	.cardTopBackground {
		width: 100%;
		height: 400rpx;
	}

	.per-card {
		width: 96%;
		margin: 0 auto;
		border: 1rpx solid;
		border-radius: 10rpx;
		height: 330rpx;
		position: relative;
		margin-top: -150rpx;

		.cardText {
			color: #fff;
			position: relative;
			margin: 0 auto;
			width: 100%;
			text-align: center;
			top: -250rpx;
		}
	}

	.per-list {
		width: 96%;
		margin: 0 auto;
		margin-top: 30rpx;
		background-color: #fbffff;
		border-radius: 10rpx;

		.perLi-te {
			padding: 20rpx 10rpx 20rpx 20rpx;
			border-bottom: 1rpx solid #f0eade;
			margin-top: 10rpx;
		}
	}
</style>
